# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=cgdb
pkgver=0.6.8
pkgrel=1
pkgdesc="Curses-based interface to the GNU Debugger"
arch=('i686' 'x86_64')
url="http://cgdb.sourceforge.net/"
license=('GPL')
depends=('libreadline' 'ncurses' 'gdb')
makedepends=('help2man' 'libreadline-devel' 'ncurses-devel')
source=("http://cgdb.me/files/${pkgname}-${pkgver}.tar.gz"
        01-msysize.patch
        02-cygwin-deprecations.patch)
sha512sums=('22580f0c2ad9c4f4efc429f94465fe54518c38f5efc95fa544ebbd93188d8e2ec740d7c3f22df1447df9af96eb4a317e4a4fbf5c771173f86ebdccbcbd776ab2'
            '31d2f2573fec3e6569b0c236d60898e5fced21bd3510add98613ce2e75f966a923917ed6eeec475844c3545004d0a17b55de96cfa3eb6f68d5a84636c563ef0e'
            'bd12b526c33828df9995d43a994f7b2f535384701974cf5f4395ec27d3856e497990ecadc1496b037741ba4af382455ad8d77c4f571c8b29023d09d1bdb79b1e')
install=cgdb.install

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/01-msysize.patch
  patch -p1 -i ${srcdir}/02-cygwin-deprecations.patch

  autoreconf -fi -I config
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure \
    --prefix=/usr \
    --build=${CHOST} \
    --with-readline=/usr \
    --with-ncurses=/usr
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}/" install
}
